package com.timeriver.domain.enums;

import lombok.Getter;

@Getter
public enum ModelCategory {

    PMML(0, "pmml"),
    SPARK(1, "spark"),
    FLINK(2, "flink"),
    PYTHON(3, "python"),
    UNDEIFINE(4, "underfine");

    private int category;
    private String name;

    ModelCategory(int category, String name) {
        this.category = category;
        this.name = name;
    }

    public static String getName(int category) {
        ModelCategory[] values = ModelCategory.values();
        for (ModelCategory value : values) {
            if (value.category == category) {
                return value.name;
            }
        }
        return ModelCategory.UNDEIFINE.name;
    }

    public static int getCategory(String name) {
        ModelCategory[] values = ModelCategory.values();
        for (ModelCategory value : values) {
            if (value.name == name) {
                return value.category;
            }
        }
        return ModelCategory.UNDEIFINE.category;
    }
}
